<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>async-exec</title>
</head>

<body>
    <h1>江畔何人初見月</h1>
    <button onclick="change()">change</button>
</body>
<script>
    var h1 = document.querySelector('h1')

    function change() {
        h1.textContent = '江畔何人初見月，江月何年初照人'
        delay(3000)
    }

    function delay(duration) {
        var start = new Date()
        while (Date.now() - start < duration) { }
    }
</script>

</html>